package com.huawei.hwid.usecase;

import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.huawei.hwid.UseCase;
import com.huawei.hwid.core.d.b.e;

public class GetAccountStatusUseCase extends UseCase<RequestValues> {
    private Context a;

    public static final class RequestValues extends com.huawei.hwid.UseCase.RequestValues {
        public static final Creator<RequestValues> CREATOR = new Creator<RequestValues>() {
            public /* synthetic */ Object createFromParcel(Parcel parcel) {
                return a(parcel);
            }

            public /* synthetic */ Object[] newArray(int i) {
                return a(i);
            }

            public RequestValues a(Parcel parcel) {
                return new RequestValues(parcel);
            }

            public RequestValues[] a(int i) {
                return new RequestValues[i];
            }
        };

        protected RequestValues(Parcel parcel) {
        }

        public int describeContents() {
            return 0;
        }

        public void writeToParcel(Parcel parcel, int i) {
        }
    }

    public /* synthetic */ void b(com.huawei.hwid.UseCase.RequestValues requestValues) {
        a((RequestValues) requestValues);
    }

    public GetAccountStatusUseCase(Context context) {
        this.a = context;
    }

    protected void a(RequestValues requestValues) {
        Cursor query;
        String string;
        Cursor cursor;
        Throwable th;
        e.b("GetAccountStatusUseCase", "GetAccountStatusUseCase", true);
        Bundle bundle = new Bundle();
        try {
            query = this.a.getContentResolver().query(Uri.parse("content://com.huawei.hwid.api.provider/hwid_account_status"), null, null, null, null);
            if (query != null) {
                try {
                    if (query.moveToFirst()) {
                        string = query.getString(query.getColumnIndex("accountstatus"));
                        if (query != null) {
                            query.close();
                        }
                        bundle.putString("accountstatus", string);
                        b().a(bundle);
                    }
                } catch (RuntimeException e) {
                    cursor = query;
                    try {
                        e.d("GetAccountStatusUseCase", "RuntimeException", true);
                        if (cursor != null) {
                            cursor.close();
                            string = null;
                            bundle.putString("accountstatus", string);
                            b().a(bundle);
                        }
                        string = null;
                        bundle.putString("accountstatus", string);
                        b().a(bundle);
                    } catch (Throwable th2) {
                        Throwable th3 = th2;
                        query = cursor;
                        th = th3;
                        if (query != null) {
                            query.close();
                        }
                        throw th;
                    }
                } catch (Exception e2) {
                    try {
                        e.d("GetAccountStatusUseCase", "Exception", true);
                        if (query != null) {
                            query.close();
                            string = null;
                            bundle.putString("accountstatus", string);
                            b().a(bundle);
                        }
                        string = null;
                        bundle.putString("accountstatus", string);
                        b().a(bundle);
                    } catch (Throwable th4) {
                        th = th4;
                        if (query != null) {
                            query.close();
                        }
                        throw th;
                    }
                }
            }
            string = null;
            if (query != null) {
                query.close();
            }
        } catch (RuntimeException e3) {
            cursor = null;
            e.d("GetAccountStatusUseCase", "RuntimeException", true);
            if (cursor != null) {
                cursor.close();
                string = null;
                bundle.putString("accountstatus", string);
                b().a(bundle);
            }
            string = null;
            bundle.putString("accountstatus", string);
            b().a(bundle);
        } catch (Exception e4) {
            query = null;
            e.d("GetAccountStatusUseCase", "Exception", true);
            if (query != null) {
                query.close();
                string = null;
                bundle.putString("accountstatus", string);
                b().a(bundle);
            }
            string = null;
            bundle.putString("accountstatus", string);
            b().a(bundle);
        } catch (Throwable th5) {
            th = th5;
            query = null;
            if (query != null) {
                query.close();
            }
            throw th;
        }
        bundle.putString("accountstatus", string);
        b().a(bundle);
    }
}
